<!--
 * @FileDescription: hr主页面下的左侧菜单栏
 * @Author: 叶永鸿、袁年政
 * @Date: 2021-7-17
 * @LastEditors: 叶永鸿
 * @LastEditTime: 2021-7-18
 -->
<template>
  <div class="left">
    <el-row class="tac">
      <el-col :span="50">
        <el-menu
          :uniqueOpened="true"
          default-active
          class="el-menu-vertical-demo"
          background-color="#cee6fa"
          text-color="#464653"
          active-text-color="#373737"
        >
          <el-menu-item index="1" @click="toAdd">
            <i class="el-icon-plus"></i>
            <template #title>添加员工</template>
          </el-menu-item>
          <el-menu-item index="2" @click="toLog">
            <i class="el-icon-plus"></i>
            <template #title>录用员工</template>
          </el-menu-item>
          <el-menu-item index="3" @click="toSearch">
            <i class="el-icon-zoom-in"></i>
            <template #title>搜索员工</template>
          </el-menu-item>
          <el-menu-item index="4" @click="toManage">
            <i class="el-icon-user-solid"></i>
            <template #title>管理员工</template>
          </el-menu-item>
        </el-menu>
      </el-col>
    </el-row>
  </div>
</template>

<script>
export default {
  name: "left",
  methods: {
    toManage() {
      var that = this;
      var page = this.$store.state.hrManage.hrManagePage;
      var totalPage;
      var manageSearchName = this.$store.state.hrManage.hrManageSearchName;

      this.$axios
        .get("http://47.100.167.206:8082/Manage/queryOnPage", {
          headers: { token: this.$store.state.loginInfor.token },
        })
        .then(
          function (response) {
            console.log(response)
            totalPage = response.data.data;
            that.$axios
              .get("http://47.100.167.206:8082/Manage/queryAllOn", {
                params: {
                  page: page,
                },
                headers: { token: that.$store.state.loginInfor.token },
              })
              .then(
                function (response) {
                  console.log(response);
                  that.$store.commit("hrManage", {
                    hrManagePage: page,
                    hrManageTotalPage: totalPage,
                    hrManageSearchName: "",
                    hrManagePerPage: response.data.data,
                  });
                  console.log("okTOPush");
                  that.$router.push("/hrMain/manage");
                },
                function (err) {
                  that.$message({
                    type: "error",
                    message: "网络错误，查看失败",
                  });
                  console.log(err);
                }
              );
          },
          function (err) {}
        );

      //this.$router.push("/hrMain/manage");
    },
    toAdd() {
      this.$router.push("/hrMain/add");
    },
    toSearch() {
      this.$router.push("/hrMain/search");
    },
    toLog() {
      this.$router.push("/hrMain/logEmp");
    },
  },
};
</script>

<style scoped>
/* .tac{
  height: 100%;
} */
.el-col {
  height: 100%;
  width: 100%;
}
.el-row {
  background-color: #d3dce6;
  color: #333;
  text-align: center;
  line-height: 100vh;
  height: 100%;
  width: 100%;
}
.el-menu {
  height: 100%;
  width: 100%;
}
.left {
  overflow-x: hidden;
  height: 100%;
}
</style>
